﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using Microhard.CustomActivities.Design;
using System.Activities;

namespace Microhard.CustomActivities.Activities
{
    [Designer(typeof(MHSingleApproverActivity))]
    public class SingleApproverActivity : MicrohardActivity
    {
        protected override void Execute(System.Activities.NativeActivityContext context)
        {
            string depName = base.DepName;
            context.CreateBookmark("SingleApproverActivity" + base.NodeName, new BookmarkCallback(OnResumeBookMark), BookmarkOptions.None);//如果为MultipleResume,则流程一直可以idel 
        }

        public void OnResumeBookMark(NativeActivityContext context, Bookmark mark, object obj)
        {
            var wfid = context.WorkflowInstanceId;
            //获得业务数据的审批结果
            bool approveResult = false;
            //如果是审批拒绝，则再创建标签，等待审批
            if (!approveResult)
            {
                //更新审批状态
              
                context.CreateBookmark("SingleApproverActivity" + base.NodeName, new BookmarkCallback(OnResumeBookMark), BookmarkOptions.None);//如果为MultipleResume,则流程一直可以idel 
            }
            else
            {
                //赋值给参数
                base.Result.Set(context, approveResult);
            }
        }
    }
}
